import {request} from "@/core/AxiosConfig";

export const TokenApi={
    /**
     * list
     * @returns
     */
    list:() => {
        return request.get(`/token/list`);
    },

    /**
     * page
     * @param {string}, queryRequest
     * @returns
     */
    page:(queryRequest) => {
        return request.get(`/token/page`,{
            params:queryRequest
        });
    },

    /**
     * login
     * @param {object}, params TokenLoginOrLogoutRequest
     * @param {string}, params.token
     * @param {string}, params.primary
     * @returns
     */
    login:(params) => {
        return request.post(`/token/login`, params);
    },

    /**
     * deleteOrLogOut
     * @param {object}, params TokenDeleteRequest
     * @param {string}, params.primary
     * @param {string}, params.token
     * @returns
     */
    deleteOrLogOut:(params) => {
        return request.delete(`/token`, {data:params});
    },

    /**
     * update
     * @param {object}, params TokenAddOrUpdRequest
     * @param {string}, params.token
     * @param {object}, params.ua_info
     * @param {string}, params.primary
     * @param {number}, params.status
     * @returns
     */
    update:(params) => {
        return request.put(`/token`, params);
    },

    /**
     * add
     * @param {object}, params TokenAddOrUpdRequest
     * @param {string}, params.token
     * @param {object}, params.ua_info
     * @param {string}, params.primary
     * @param {number}, params.status
     * @returns
     */
    add:(params) => {
        return request.post(`/token`, params);
    },
    /**
     * logout
     * @param {object} params TokenLoginOrLogoutRequest
     * @param {string} params.token
     * @param {string} params.primary
     * @returns
     */
    kickout:(params) =>{
        return request.post(`/token/kickout`, params);
    }
}